/**
 * 
 */
package com.kth.subtranslator.ui;

import java.awt.Component;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;

import com.kth.subtranslator.ITranslateDriver;

public class DriverRenderer extends DefaultListCellRenderer {
	
	private static final long serialVersionUID = -1763677134460366459L;

	/* (non-Javadoc)
	 * @see javax.swing.DefaultListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
	 */
	@Override
	public Component getListCellRendererComponent(JList list, Object value,
			int index, boolean isSelected, boolean cellHasFocus) {
		if (value instanceof ITranslateDriver) {
			value = ((ITranslateDriver)value).getName();
		}
		return super.getListCellRendererComponent(list, value, index, isSelected,
				cellHasFocus);
	}
	
}